import i18n from '@/lang'
import Vue from 'vue'
export const adasEcuConfigCols = [
  {
    title: i18n.t('品牌'),
    dataIndex: 'company',
    width: 130,
    customRender: (text, record, index) => {
      return Vue.$store.getters.getDictCodeObj('companyDictCode')[text] || text;
    },
  },
  {
    title: i18n.t('modelName'),
    dataIndex: 'name',
    width: 200,
  },
  {
    title: i18n.t('modelCode'),
    dataIndex: 'code',
    width: 150,
  },
  {
    title: i18n.t('智驾ECU开启数量'),
    dataIndex: 'idriveEcuEnableNum',
    width: 150,
    customRender: (text, record, index) => {
      return (record.idriveEcuEnableNum || 0) + '/' + (record.idriveEcuTotalNum || 0);
    },
  },
  {
    title: i18n.t('测试车辆开启数量'),
    dataIndex: 'idriveTestVehicleEnableNum',
    width: 150,
    customRender: (text, record, index) => {
      let idriveVehicleEnableNum = record.idriveTestVehicleEnableNum || 0;
      if (record.testModelIDriveUrlAttr === 'all') {
        idriveVehicleEnableNum = record.idriveTestVehicleTotalNum;
      }else if (record.testModelIDriveUrlAttr === 'none') {
        idriveVehicleEnableNum = 0;
      }
      return idriveVehicleEnableNum + '/' + (record.idriveTestVehicleTotalNum || 0);
    },
  },
  {
    title: i18n.t('正式车辆开启数量'),
    dataIndex: 'idriveNormalVehicleEnableNum',
    width: 150,
    customRender: (text, record, index) => {
      let idriveVehicleEnableNum = record.idriveNormalVehicleEnableNum || 0;
      if (record.modelIDriveUrlAttr === 'all') {
        idriveVehicleEnableNum = record.idriveNormalVehicleTotalNum;
      }else if (record.modelIDriveUrlAttr === 'none') {
        idriveVehicleEnableNum = 0;
      }
      return idriveVehicleEnableNum + '/' + (record.idriveNormalVehicleTotalNum || 0);
    },
  },
  {
    title: i18n.t('校验开关'),
    dataIndex: 'idriveUrlLimit',
    width: 80,
    scopedSlots: { customRender: 'idriveUrlLimit' }
  },
  {
    title: i18n.t('operation'),
    dataIndex: 'action',
    width: 265,
    fixed: 'right',
    scopedSlots: { customRender: 'action' }
  }
]